<?php

class Application_Model_util_CreateViewUtil {
	public static function createViewShortDetailSanPham($sanPham){
		$sanPham instanceof Application_Model_bean_SanPham;
		$listChucNang=$sanPham->getChucNangSanpham();
		$listHinh=$sanPham->getHinhAnh();
		ob_start();
		?>
		<div id="sanPham">
			<div class="content">
				<div class="leftContent">
					<div class="imgBackground">
						<div class="img1"><?php echo '<img src="../images/sanPham/'.$listHinh[0].'"/>'?></div>
						<div class="img2"><?php echo '<img src="../images/sanPham/'.$listHinh[1].'"/>'?></div>
						<div class="img3"><?php echo '<img src="../images/sanPham/'.$listHinh[2].'"/>'?></div>
					</div>
					<label>Tên sản phẩm: </label> <?php echo $sanPham->getTenSanPham()?><br />
					<label>Giá bán: </label> <?php echo $sanPham->getGiaBan()?> USD<br />
					<label>Tình trạng: </label> <?php echo $sanPham->getTinhTrang()?><br />
					<input type="button" value="Add cart" style="margin-left: 5px;"/> <input type="text" size="3"/><br />
				</div>
				<div class="rightContent">
					
				<?php 
					foreach ($listChucNang as $value) {
						if($value->getId()!=1){
						$listItem=$value->getListItem();
						$tenNhomChucNang=$value->getTenChucNang();
						$hinhIcon=$value->getHinhIcon();
						?>
						<div class="itemChucNang">
							<div class="itemChucNangImg">
							<?php echo '<img src="../images/sanPham/chucNang/'.$hinhIcon.'" />';?>
							</div>
							<div class="itemChucNangInfo">
						<?php 
						foreach ($listItem as $item) {
							$idItem=$item->getId();
							$noiDung=$item->getNoiDung();
							 echo $noiDung.'<br />';
						}
						?>	
						</div>
						</div> 
						<?php 
						}
					}
				?>
					
				</div>
			</div>
		</div>
		<?php 
		echo ob_get_clean();
	}
	public static function createViewDetailSanPham($sanPham){
		$sanPham instanceof Application_Model_bean_SanPham;
		$listChucNang=$sanPham->getChucNangSanpham();
		$listHinh=$sanPham->getHinhAnh();
		ob_start();
		?>
		<div id="sanPham">
			<div class="content">
				<div class="leftContent">
					<div class="imgBackground">
						<div class="img1"><?php echo '<img src="../images/sanPham/'.$listHinh[0].'"/>'?></div>
						<div class="img2"><?php echo '<img src="../images/sanPham/'.$listHinh[1].'"/>'?></div>
						<div class="img3"><?php echo '<img src="../images/sanPham/'.$listHinh[2].'"/>'?></div>
					</div>
					<label>Tên sản phẩm: </label> <?php echo $sanPham->getTenSanPham()?><br />
					<label>Giá bán: </label> <?php echo $sanPham->getGiaBan()?> USD<br />
					<label>Tình trạng: </label> <?php echo $sanPham->getTinhTrang()?><br />
					<input type="button" value="Add cart" style="margin-left: 5px;"/> <input type="text" size="3"/><br />
				</div>
				<div class="rightContent">
					
				<?php 
					foreach ($listChucNang as $value) {
						if($value->getId()!=1){
						$listItem=$value->getListItem();
						$tenNhomChucNang=$value->getTenChucNang();
						$hinhIcon=$value->getHinhIcon();
						?>
						<div class="itemChucNang">
							<div class="itemChucNangImg">
							<?php echo '<img src="../images/sanPham/chucNang/'.$hinhIcon.'" />';?>
							</div>
							<div class="itemChucNangInfo">
						<?php 
						foreach ($listItem as $item) {
							$idItem=$item->getId();
							$noiDung=$item->getNoiDung();
							 echo $noiDung.'<br />';
						}
						?>	
						</div>
						</div> 
						<?php 
						}
					}
				?>
					
				</div>
			</div>
			<div id="tabs">
				  <ul>
				    <li><a href="#" class="hover"><span>Thông tin kỹ thuật</span></a></li>
				    <li><a href="#"><span>Nhận xét</span></a></li>
				  </ul>
			</div>
			<div class="footerSP">
				<?php echo $sanPham->getChucNangDacBiet()?>
			</div>
		</div>
		<?php 
		echo ob_get_clean();
	}
	
	public static function createViewListSanPham($listSanPham){
		foreach ($listSanPham as $it) {
		$it instanceof Application_Model_bean_SanPham;
		$hinh=$it->getHinhAnh();
		ob_start();
		?>
		 <div class="prod_box">
	        <div class="top_prod_box"></div>
	        <div class="center_prod_box">
	          <div class="product_title">
	           <a class="bumpbox"	href="../sanpham/load?id=<?php echo $it->getMaSanPham()?>" rel="670,450,<?php echo $it->getTenSanPham()?>,/sanpham/viewajax?id=<?php echo $it->getMaSanPham()?>">
	          	<?php echo $it->getTenSanPham()?>
	           </a>
	           </div>
	          <div class="product_img"> <a title="header=[<?php echo $it->getMoTa()?>] body=[&nbsp;] fade=[on]" class="bumpbox"	href="/sanpham/load?id=<?php echo $it->getMaSanPham()?>" rel="670,450,<?php echo $it->getTenSanPham()?>,/sanpham/viewajax?id=<?php echo $it->getMaSanPham()?>"><img src="../images/sanpham/<?php echo $hinh[0]?>" alt="" border="0" /></a></div>
	          <div class="prod_price"><span class="reduce"></span> <span class="price"><?php echo $it->getGiaBan().'$'?></span></div>
	        </div>
	        <div class="bottom_prod_box"></div>
			 <div class="prod_details_tab"> <a class="addCart"  href="<?php echo $it->getMaSanPham()?>" title="header=[Thêm 1 cái vào giỏ hàng] body=[&nbsp;] fade=[on]"><img src="../images/cart.gif" alt="" border="0" class="left_bt" /></a> <a href="#" title="header=[Specials] body=[&nbsp;] fade=[on]"><img src="../images/favs.gif" alt="" border="0" class="left_bt" /></a> <a href="#" title="header=[Gifts] body=[&nbsp;] fade=[on]"><img src="../images/favorites.gif" alt="" border="0" class="left_bt" /></a> <a href="/sanpham/load?id=<?php echo $it->getMaSanPham()?>" class="prod_details">details</a> </div>        
	      </div>
		<?php 
		echo ob_get_clean();
		}
	}
}

?>